chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
  if (request.action === "getCookies" || request.action === "getAllCookies") {
    chrome.cookies.getAll({url: request.url}, function(cookies) {
      sendResponse(cookies);
    });
    return true;
  }
});
